package com.craney.testUnderPoint
{
	import com.craney.myRect.MyRect;
	
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class TestUnderPoint
	{
		private var parentSprite:Sprite;
		
		public function TestUnderPoint(ps:Sprite)
		{
			parentSprite = ps;
			
			var rect1:MyRect = new MyRect(10, 10, 100, 100);
			var rect2:MyRect = new MyRect(100, 40, 200, 80, 0x345FFF);
			var rect3:MyRect = new MyRect(150, 99, 90, 100, 0xff00ff);
			
			rect1.name = "No.1";
			rect2.name = "No.2";
			rect3.name = "No.3";
			
			parentSprite.addChild(rect1);
//			parentSprite.addChild(rect2);
//			parentSprite.addChild(rect3);
			
			var myX:int = 110;
			var myY:int = 109;
			var myP:Point = new Point(myX, myY);
			var targRect:MyRect = new MyRect(myX, myY, 3, 3, 0x000000);
			parentSprite.addChild(targRect);
			
			var resultArray:Array = parentSprite.getObjectsUnderPoint(myP);
			
			trace("length = " + resultArray.length);
			
			for each(var e:* in resultArray)
			{
				trace(e.name);
			}
			
			
		}

	}
}